<template>
	<!-- 执行结果 -->
	<div class="executionResult">
		<CommonTitle titleName="任务节点实施成果清单"></CommonTitle>
		<!-- <public-table
			class="m-t20"
			index
			border
			:isPaging="false"
			:page="state.page"
			:tableData="state.tableData"
			:span-method="objectSpanMethod"
			:tableOption.sync="tableOption"
		>
			 <template #actionName="{ row }">
				<span>招标任务</span>
			</template> 
			<template #operation="scope">
				<span style="cursor: pointer; color: #fc7037">{{
					scope.row.operation
				}}</span>
			</template>
		</public-table> -->
		<el-table
			ref="singleTableRef"
			:data="state.tableData"
			highlight-current-row
			style="width: 100%"
			:span-method="objectSpanMethod"
			border
			@current-change="handleCurrentChange"
		>
			<el-table-column type="index" width="50" />
			<el-table-column property="" label="任务类型">
				<span>招标任务</span>
			</el-table-column>
			<el-table-column property="actionResult" label="实施行为" />
		</el-table>
	</div>
</template>

<script setup>
import { ref, reactive, onMounted } from "vue";
import PublicTable from "@/components/PublicTable";
import CommonTitle from "@/components/CommonTitle.vue";
import { processApi } from "@/api/biddingProject";

const tableOption = ref([
	{ label: "任务类型", prop: "actionName" },
	{ label: "实施行为 ", prop: "actionResult", width: 550 },
]);

const state = reactive({
	tableData: [],
	page: {
		total: 0,
		current: 1,
		size: 50,
	},
});
const getAllNodeActions = () => {
	processApi.getAllNodeActions().then((res) => {
		if (res.code == 200) {
			state.tableData = res.data;
		}
	});
};
const objectSpanMethod = ({ row, column, rowIndex, columnIndex }) => {
	let _row = state.tableData.length;
	console.log("wwwwww->", _row);
	if (columnIndex === 1) {
		if (rowIndex == 0) {
			return {
				rowspan: _row,
				colspan: 1,
			};
		} else {
			//其他行
			//因为合并了前两行，第0行已经占两行了，第一行，应该隐藏，其他行正常显示
			if (rowIndex < _row) {
				return {
					rowspan: 0,
					colspan: 1,
				};
			}
		}
	}
};
onMounted(() => {
	getAllNodeActions();
});
</script>
<style lang="scss" scoped>
.executionResult {
}
</style>
